﻿
<script type="text/javascript" src="http://viettelmap.vn/VTMapService/VTMapAPI?api=VTMap&type=main&k=dffc8675fc5d781ea8f0131f7d855565"></script>


@Scripts.Render("~/Scripts/ViewMapArea.js")
<script src="~/Scripts/Airview-master/vendor/tooltip.min.js"></script>
<script src="~/Scripts/Airview-master/airview.min.js"></script>
@Styles.Render("~/Content/styleMap_navbar.css")

<script>
    @functions{
        public string GetAntiForgeryToken()
        {
            string cookieToken, formToken;
            AntiForgery.GetTokens(null, out cookieToken, out formToken);
            return cookieToken + "," + formToken;
        }
    }
    var pwidth = 560;
    var pheight = pwidth * 0.7;
    var strUrlGetAreaCode = '@Url.Action("GetAreaBoundPointByAreaCode", "Area")';

    var strMaDiaBanPrint = null;

    $(document).ready(function () {
        $('#map').width(pwidth);
        $('#map').height(pheight);

        var jsonResult;
        $.ajax({
            //url: '/Area/GetAreaBoundPointByAreaCode',
            url: strUrlGetAreaCode,
            headers: {
                'VerificationToken': '@GetAntiForgeryToken()'
            },
            type: "GET",
            dataType: "json",
            cache: false,
            data: { 'AREA_CODE': '@ViewBag.Area_code' },
            success: function (data) {
                jsonResult = data;
            },
            error: function (xhr) {
                alert('co loi khi load 202!');
                return null;
            },
            complete: function (jqXHR, textStatus) {
                if (jsonResult == "") {
                    $('#not').show();
                }
                else {
                    //alert(1);
                    $('#Ok').show();
                    var arrPoints = new Array();
                    $.each(jsonResult, function (i, item) {
                        arrPoints.push(new viettel.LatLng(item.Lat, item.Lon));
                    });
                    loadMapToDraw('@ViewBag.CommuneCode', arrPoints);
                }
            }
        });
    });

</script>

<div id="not" class="row" style=" display: none">
    <div class="col-md-12">
        Bản đồ chưa được thiết lập
    </div>
</div>

<div id="Ok" class="row" style="margin-top: 5px; display: none; ">
    <div class="col-md-12">
        <div id='map' class="map_content"></div>
    </div>
</div>

